package com.buleqr.controller;

import com.buleqr.dto.request.SearchFriendsGroupsQuery;
import com.buleqr.dto.response.SearchFriendsGroupsVo;
import com.buleqr.pojo.AjaxResult;
import com.buleqr.service.FriendsGroupSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 好友与群的接口
 *
 * @author maple
 */
@Slf4j
@Api(tags = "好友与群的接口")
@RestController
@RequestMapping("/FriendsGroup")
public class FriendsGroupSearchController {

    private final FriendsGroupSearchService friendsGroupSearchService;

    public FriendsGroupSearchController(FriendsGroupSearchService friendsGroupSearchService) {
        this.friendsGroupSearchService = friendsGroupSearchService;
    }

    @ApiOperation("搜索群与好友")
    @PostMapping("/search")
    public AjaxResult searchFriendsGroups (@RequestBody SearchFriendsGroupsQuery query) {
        SearchFriendsGroupsVo friendsGroupsVo = friendsGroupSearchService.searchFriendsGroups(query);
        AjaxResult ajaxResult = AjaxResult.success(friendsGroupsVo);
        return ajaxResult;
    }
}
